#!/usr/bin/env python3
"""
Qwen2-VL Demo 启动脚本
"""

import os
import sys
from app import app

if __name__ == '__main__':
    # 检查环境变量
    required_vars = ['SILICONFLOW_API_KEY', 'SILICONFLOW_API_URL', 'MODEL_NAME']
    missing_vars = [var for var in required_vars if not os.getenv(var)]
    
    if missing_vars:
        print("❌ 缺少必要的环境变量:")
        for var in missing_vars:
            print(f"   - {var}")
        print("\n请检查.env文件配置")
        sys.exit(1)
    
    port = int(os.getenv('PORT', 3000))
    
    print("🚀 启动 Qwen2-VL Demo")
    print(f"📍 本地访问: http://localhost:{port}")
    print(f"🌐 IP访问: http://0.0.0.0:{port}")
    print("📝 请确保API密钥配置正确")
    print("-" * 50)
    
    app.run(host='0.0.0.0', port=port, debug=True) 